<script type="text/javascript"><!--
var form = "";
var submitted = false;
var error = false;
var error_message = "";

function formSubmit() {
  if (submitted == true) {
    alert("This form has already been submitted. Please press Ok and wait for this process to be completed.");
    return false;
  }

  error = false;
  form = document.checkout_confirmation;
  form.actionForm.value = 'submit';
	submitted = true;	
	form.submit();
	return true;
}
//--></script>
<h1>Order Confirmation</h1>
 <{if $isError == "true"}>
				
				<{$error}>			
		<{/if}>
<form name="checkout_confirmation" action="<{$APPLICATION_URL}>/<{$ownerName}>Product/confirmOrder" method="post">
<div class="contentContainer">
  <h2>Shipping Information</h2>
  <div class="contentText">
    <table border="0" width="100%" cellspacing="1" cellpadding="2">
      <tbody>
	 
	  <tr>
        <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tbody><tr>
            <td><strong>Delivery Address</strong> <a href="<{$APPLICATION_URL}>/<{$ownerName}>MyAccount/addAddress/type/ship/confirm/1"><span class="orderEdit">(Edit)</span></a></td>
          </tr>
          <{if $shippingAddress}>
          <tr>
            <td><{$shippingAddress->getName()}><br> <{$shippingAddress->street}><br> <{$shippingAddress->getState()}>, <{$shippingAddress->city}>    <{$shippingAddress->postCode}><br> <{$shippingAddress->getCountry()}></td>
          </tr>
          <{/if}>
          <tr>
            <td><strong>Shipping Method</strong></td>
          </tr>
          <tr>
            <td><{$shippingMethod->name}></td>
          </tr>
        </tbody></table></td>
        <td width="70%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tbody><tr>
            <td colspan="3"><strong>Products</strong> <a href="<{$APPLICATION_URL}>/<{$ownerName}>Product/shoppingCart"><span class="orderEdit">(Edit)</span></a></td>
          </tr>
		  <{assign var=subTotal value=0}>
		<{foreach item=cartItem from=$cartList}>
		<{assign var=product value=$cartItem->getProduct()}>
		<{assign var=customer value=$cartItem->getCustomer()}>
		<{assign var=finalPrice value=$cartItem->finalPrice}>
          <tr>
            <td align="right" valign="top" width="30"><{$cartItem->quantity}>&nbsp;x&nbsp;</td>
            <td valign="top"><{$product->getName()}></td>
            <td align="right" valign="top"><{$currencySymbol}><{$cartItem->finalPrice|string_format:"%.2f"}></td>
          </tr>
		  
		  <{assign var=subTotal value=$subTotal+$finalPrice}>
		  <{/foreach}>

        </tbody></table></td>
      </tr>
    </tbody></table>
  </div>

  <h2>Billing Information</h2>

  <div class="contentText">
    <table border="0" width="100%" cellspacing="1" cellpadding="2">
      <tbody><tr>
        <td width="30%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tbody>
          <{if $billingAddress}>
          <tr>
            <td><strong>Billing Address</strong> <a href="<{$APPLICATION_URL}>/<{$ownerName}>MyAccount/addAddress/type/bill/confirm/1"><span class="orderEdit">(Edit)</span></a></td>
          </tr>
          <tr>
            <td><{$billingAddress->getName()}><br> <{$billingAddress->street}><br> <{$billingAddress->getState()}>, <{$billingAddress->city}>    <{$billingAddress->postCode}><br> <{$billingAddress->getCountry()}></td>
          </tr>
		   <tr>
            <td>&nbsp;</td>
          </tr>
          <{/if}>
          <tr>
            <td><strong>Payment Method</strong> </td>
          </tr>
		 
          <tr>
            <td><{$paymentMethod}></td>
          </tr>
        </tbody></table></td>
        <td width="70%" valign="top" align="right"><table border="0" cellspacing="0" cellpadding="2">
				<{assign var=total value=$subTotal+$shippingMethod->fee}>
              <tbody><tr>
                <td align="right" class="main">Sub-Total:</td>
                <td align="right" class="main"><{$currencySymbol}><{$subTotal|string_format:"%.2f"}></td>
              </tr>              <tr>
                <td align="right" class="main"><{$shippingMethod->name}>:</td>
                <td align="right" class="main"><{$currencySymbol}><{$shippingMethod->fee|string_format:"%.2f"}></td>
              </tr>              <tr>
                <td align="right" class="main">Total:</td>
                <td align="right" class="main"><strong><{$currencySymbol}><{$total|string_format:"%.2f"}></strong></td>
              </tr>
        </tbody></table></td>
      </tr>
    </tbody></table>
  </div>
  <h2><strong>Comments About Your Order</strong></h2>
  <div class="contentText">
    <{$comment}><input type="hidden" name="comment" value="<{$comment}>">  </div>
  <div class="contentText">
    <div style="float: right;">
		<button onclick="return formSubmit();">Confirm Order</button>		
    </div>
  </div>
</div>
<input type="hidden" id="actionForm" name="actionForm" value=""/>
</form>

